package J20250330_real;

/**
 * Created with IntelliJ IDEA.
 * Description: k倍区间——https://www.lanqiao.cn/problems/97/learning/?page=1&first_category_id=1&second_category_id=3&difficulty=20
 * User: 王圆豪
 * Date: 2025-04-07
 * Time: 20:15
 */
import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main11 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) arr[i] = scan.nextInt();
        int[][] dp = new int[n+1][n+1];
        int ret = 0;
        for(int i = 1; i <= n; i++){
            for(int j = i; j <= n; j++){
                dp[i][j] = arr[j-1] + dp[i][j-1];
                if(dp[i][j] % k == 0) ret++;
            }
        }
        System.out.println(ret);
        scan.close();
    }
}